<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        var phoneNumber = prompt("请输入你的手机号");
        console.log(typeof phoneNumber);
        console.log(phoneNumber.length);

        if(phoneNumber.length == 11){
            alert("手机号正确");
        }else{
            alert("手机号不正确");
        }

    </script>
</head>
<body>
    
</body>
</html>